// 模拟三个异步任务，比如三个API请求
const task1 = new Promise((resolve) => setTimeout(() => resolve('任务1完成'), 1000));
const task2 = new Promise((resolve) => setTimeout(() => resolve('任务2完成'), 1500));
const task3 = new Promise((resolve) => setTimeout(() => resolve('任务3完成'), 800));

// 使用Promise.all()并行执行任务
Promise.all([task1, task2, task3]).then((results) => {
    console.log(results); 
    // ['任务1完成', '任务2完成', '任务3完成']
}).catch((error) => {
    console.log('有任务失败：', error);
});